package stdio.costa;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

public abstract class Entities<T> {
	
	protected List<T> entities;

	public int size() {
		return getEntities().size();
	}
	
	public void add(T... entities) {
		for(T entity : entities) {
			getEntities().add(entity);
		}
	}
	
	public void add(Collection<T> entities) {
		getEntities().addAll(entities);
	}
	
	public List<T> getEntities() {
		if(entities == null) {
			entities = new ArrayList<T>();
		}
		return entities;
	}

	public void setEntities(List<T> entities) {
		this.entities = entities;
	}
}
